﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using VideoFlowStatistics.Class;

namespace VideoFlowStatistics
{
    public partial class FormSearchList : Form
    {
        public FormSearchList()
        {
            InitializeComponent();
        }

        private DataTable dtSearch;

        private void FormSearchList_Load(object sender, EventArgs e)
        {
            this.dtpStartTime.Value = DateTime.Now;
            this.dtpEndTime.Value = DateTime.Now.AddDays(2);

            //SetProStatic(true);
            //System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(InitSearch));
            //thread.Start();
        }

        //void InitSearch()
        //{
        //    dtSearch = VideoFlowStatistics.Class.XmlHelper.Read();
        //    SetProStatic(false);
        //}

        void SetProStatic(bool IsProcess)
        {
            if (this.InvokeRequired)
            {
                Action<bool> call = new Action<bool>(SetProStatic);
                this.Invoke(call, new object[] { IsProcess });
            }
            else {
                this.btnSearch.Enabled = !IsProcess;
            }
        }

        //查询绑定
        private void btnSearch_Click(object sender, EventArgs e)
        {
            drvlist.DataSource = XmlHelper.Read(this.dtpStartTime.Value, this.dtpEndTime.Value);
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }
    }
}
